﻿using System;
using System.Collections.ObjectModel;
using System.IO;
using System.Xml.Serialization;

namespace CHomeWeather
{
    public class Configuration : XmlSerializableObject<Configuration>
    {
        public const string CONFIGURATION_FILE_NAME = "config.xml";

        private const string DEFAULT_SCHEDULE_TIME = "08:00:00";
        private const string DEFAULT_TEMPLATE_PATH = "Templates\\default.xml";

        /// <summary>
        /// Initializes a new instance of <see cref="Configuration"/>.
        /// </summary>
        public Configuration()
        {
        }

        /// <summary>
        /// Gets or set the city list.
        /// </summary>
        [XmlArrayItem("City")]
        public Collection<string> Cities { get; set; }

        /// <summary>
        /// Gets or sets the update template.
        /// </summary>
        public string Template { get; set; }

        /// <summary>
        /// Gets or sets the target registry key.
        /// </summary>
        public string TargetRegistryKey { get; set; }

        /// <summary>
        /// Gets or sets the icon path.
        /// </summary>
        public string IconFolder { get; set; }

        /// <summary>
        /// Gets or sets the update schedule.
        /// </summary>
        public Collection<Schedule> Schedules { get; set; }

        /// <summary>
        /// Initializes the configuration with default values.
        /// </summary>
        protected void Initialize()
        {
            Template = DEFAULT_TEMPLATE_PATH;
        }
    }
}
